package au.com.bus4u.utils;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

public class JsonResult<T> {
	
	@JsonInclude(value= Include.ALWAYS)
	private Integer code;
	@JsonInclude(value= Include.NON_NULL)
	private String msg;
	@JsonInclude(value= Include.ALWAYS)
	private T result;

	public JsonResult() {
	}

	public JsonResult(Integer code) {
		this.code = code;
	}
	
	public JsonResult(Integer code, String msg) {
		super();
		this.code = code;
		this.msg = msg;
	}

	public JsonResult(Integer code, T result) {
		super();
		this.code = code;
		this.result = result;
	}

	public JsonResult(String msg) {
		this.msg = msg;
	}

	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public T getResult() {
		return result;
	}
	public void setResult(T result) {
		this.result = result;
	}

	@Override
	public String toString() {
		return "JsonResult [code=" + code + ", msg=" + msg + ", result=" + result + "]";
	}
	
	
}
